<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
    <div class="tip-title demand-item" id="replyForm" style="margin-top: 5%">
        <form class="layui-form" action="" id="layui-form-reply">
            <input value="${replyPid!}" name="replyPid" hidden>
            <input value="${consuId!}" name="conId" hidden/>
            <div class="layui-form-item layui-form-text">
                <div class="layui-input-block">
                    <textarea class="layui-textarea" name="content" id="editTextReply"  lay-verify="article_desc" hidden></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block" style="text-align: center">
                    <button class="layui-btn" lay-submit="" lay-filter="submit_filter_reply">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
    <script type="text/javascript">
        layui.use(['form','layedit','jquery'], function(){
            var layedit = layui.layedit,form = layui.form,$ = jQuery = layui.$;
            var indexReply=layedit.build('editTextReply', {
                //设置编辑器高度
                height: 200,
                //清除一些工具
                hideTool:["link","image","face"],
            });
            //表单验证
            form.verify({
                article_desc:function(value,domObj){
                    layedit.sync(indexReply);
                }
            });
            //表单提交验证
            form.on('submit(submit_filter_reply)', function (data) {
                var text=layedit.getContent(indexReply);
                if(text==''||text==""){
                    layerDef("请填回复内容!",0);
                    return false;
                }
                if(text.length>30000){
                    layerDef("长度不得大于30000个字符!",5);
                    return false;
                }
                var ajaxStrtus=true;
                if(ajaxStrtus){
                    ajaxStrtus=false;
                    $.ajax({
                        type:'post',
                        url:'/reply/reply2Reply',
                        data:JSON.stringify(data.field),
                        contentType: "application/json",
                        dataType:'json',
                        success:function(data){
                            ajaxStrtus=true;
                            if(data.responseCode=='0'){
                                closeLayeropen();
                            }else{
                                layerDef(data.responseDesc,5);
                            }
                        },
                        error:function(){
                            ajaxStrtus=true;
                        }
                    });
                }
                return false;
            });

        });
    </script>
</body>
</html>